﻿using Mt.Site.Core.Common.Cache;
using Mt.Site.Core.Organizations.UserCache.Models;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Mt.Site.Core.Organizations.UserCache
{
    public interface IUserAndUnitFinder
    {
        /// <summary>
        ///  由用户ID序列获取名字序列
        /// </summary>
        /// <param name="idList">用户id</param>
        /// <returns>用户姓名</returns>
        Task<List<string>> GetUserNameListAsync(List<long> idList);

        /// <summary>
        /// 由用户ID序列获取名字
        /// </summary>
        /// <param name="id">用户id</param>
        /// <returns>用户姓名</returns>
        Task<string> GetUserNameAsync(long id);

        /// <summary>
        /// 流程选人的人员筛选
        /// </summary>
        /// <param name="limitedUnitIdList"></param>
        /// <param name="limitedUserIdList"></param>
        /// <param name="userFilter"></param>
        /// <param name="autherInfo"></param>
        /// <param name="needKnowInitiatingUnit">是否按主办部门筛选</param>
        /// <param name="sponsoringUnitId">主办部门</param>
        /// <returns></returns>
        Task<GetUserListResult> GetUserListAsync(List<long> limitedUnitIdList, List<long> limitedUserIdList, UserFilter userFilter, UserInfoDto autherInfo, long sponsoringUnitId);

        Task<List<UserSelectionData>> GetUserItemListAsync(List<long> limitedUnitIdList, List<long> limitedUserIdList);

        UserInfoDto GetUserInfo(int? tenantId, long userId);
        Task<UserInfoDto> GetUserInfoAsync(int? tenantId, long userId);

        /// <summary>
        /// 用户基本信息，目前基本供拟稿所用（部门只拉取主部门）
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        Task<UserInfoDto> GetUserInfoAsync(long userId);

        UserInfoDto GetUserInfo(long userId);

        UserInfoDto GetCurrentUserInfo();

        Task<UserInfoDto> GetCurrentUserInfoAsync();

        /// <summary>
        /// 所有已发布的部门
        /// </summary>
        /// <returns></returns>
        Task<List<UnitSelectionData>> GetAllUnitSelectionData();

        /// <summary>
        /// select下拉框使用
        /// </summary>
        /// <param name="UserIdList">用户id集合</param>
        /// <returns></returns>
        Task<List<UnitSelectionData>> GetUnitsWithTheirParents(List<long> UserIdList);

        /// <summary>
        /// 为部门补充他们的上级部门数据，jstree使用
        /// </summary>
        /// <param name="UnitUnits"></param>
        /// <returns></returns>
        Task<List<UnitSelectionData>> GetUnitsWithTheirParents(IEnumerable<UnitSelectionData> UnitUnits);

        /// <summary>
        /// 部门下的人员（包括下级部门中的人员）
        /// </summary>
        /// <param name="unitId"></param>
        /// <returns></returns>
        Task<List<long>> GetUserIdListByUnitId(long unitId);

        /// <summary>
        /// 拉取所有已发布的职务
        /// </summary>
        /// <returns></returns>
        Task<List<PostItemData>> GetAllPostAsync();

        /// <summary>
        /// 查找特殊用户（董事长，总经理，办公室主任等）
        /// </summary>
        /// <returns></returns>
        Task<SpecialUserData> GetSpecialUserDataAsync();


        List<PostItemData> GetAllPostCache();
        Task<List<PostItemData>> GetAllPostCacheAsync();

        List<UnitSelectionData> GetAllUnitCache();

        Task<List<UnitSelectionData>> GetAllUnitCacheAsync();

        List<UserListCacheItem> GetAllUserCache();

        Task<List<UserListCacheItem>> GetAllUserCacheAsync();

        Task<List<UserOrganinzedCacheItem>> GetUserOrganinzedCacheAsync();
    }
}
